﻿<%@ Page Title="" Language="C#" MasterPageFile="~/System/BidProject.master" AutoEventWireup="true" CodeFile="BidPrice1ca.aspx.cs" Inherits="Bidder_BidPrice1ca"  EnableEventValidation = "false"%>
<%@ Register Src="../System/DbPageFlip.ascx" TagName="DbPageFlip" TagPrefix="uc2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<script  type="text/javascript" language="javascript">
    function changeTwoDecimal_f(x) {
        var f_x = parseFloat(x);
        if (isNaN(f_x)) {
            alert('function:changeTwoDecimal->parameter error');
            return false;
        }
        var f_x = Math.round(x * 100) / 100;
        var s_x = f_x.toString();
        var pos_decimal = s_x.indexOf('.');
        if (pos_decimal < 0) {
            pos_decimal = s_x.length;
            s_x += '.';
        }
        while (s_x.length <= pos_decimal + 2) {
            s_x += '0';
        }
        return s_x;
    }

    var  strServerRan = "<%=strEncRan%>";         //取服务端的加密随机数
 
    var strContainer = "<%=strContainer %>"           //容器
      
    function CheckUPrice() {
        try {
            var priceList = document.getElementById("<%=GridView1.ClientID%>").getElementsByTagName("input");
            var id = 2;
            for (var i = 0; i < priceList.length; i++) {
                if (priceList[i].value != null && priceList[i].value.length > 0) {
                    var p = priceList[i].value;
                    if (priceList[i].type != "text") continue;
                    //加密处理

                    document.getElementById("ctl00_ContentPlaceHolder1_GridView1_ctl0" + id + "_H1").value = oCrypto.EncStr(strServerRan, changeTwoDecimal_f(p)); //报价加密

                    if (oCrypto.DecStr(strServerRan, document.getElementById("ctl00_ContentPlaceHolder1_GridView1_ctl0" + id + "_H1").value) != changeTwoDecimal_f(p)) {
                            alert("加密失败");
                            return false;
                        }
               

                    if (p != "") {
                        document.getElementById("ctl00_ContentPlaceHolder1_GridView1_ctl0" + id + "_HP1").value = oCrypto.signedData(changeTwoDecimal_f(p), strContainer);
                    }
                    
                }
            }

            return true;
        }
        catch (e) {
            alert("错误名称： " + e.name + " / 错误信息： " + e.message);
            return false;
        }
    }
    
 </script>
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td class="intro_wordbg">
                药品报价
            </td>
            <td background="../images/intro_bg.gif">
                <img src="../images/intro_right.jpg" width="118" height="34" />
            </td>
        </tr>
    </table>
    <table border="1" width="100%">
        <tr>
            <td style="width: 101px">
                通用名：
            </td>
            <td>
                <asp:TextBox ID="ProductName" runat="server" Width="201px"></asp:TextBox>
            </td>
            <td style="width: 163px">
                剂型：
            </td>
            <td>
                <asp:TextBox ID="txtMedicinemodel" runat="server" Width="201px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="width: 101px">
                生产企业：
            </td>
            <td>
                <asp:TextBox ID="txtCompanySc" runat="server" Width="201px"></asp:TextBox>
            </td>
            <td style="width: 163px">
                生产企业注册号：
            </td>
            <td>
                <asp:TextBox ID="txtUserCode_SC" runat="server" Width="201px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="width: 101px; height: 23px;">
                 商品流水号：
            </td>
            <td style="height: 23px">
                <asp:TextBox ID="txtGoodsId" runat="server" Width="201px"></asp:TextBox>
            </td>
            <td style="width: 163px; height: 23px;">
                报价状态：
            </td>
            <td style="height: 23px">
                <asp:DropDownList ID="lstPriceState" runat="server" Width="201px">
                    <asp:ListItem>全部</asp:ListItem>
                    <asp:ListItem>未报价</asp:ListItem>
                    <asp:ListItem>已报价</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td align="center" colspan="3">
                <asp:Label runat="server" ID="ErrorMsg" Font-Bold="True" ForeColor="Red" Font-Size="X-Small"
                    Width="555px">每页的报价分开提交，报价结束后必须打印、密封提交到招标办！</asp:Label>
            </td>
            <td>
                <asp:Button ID="ButSelect" runat="server" Text="查 询" class="button_bg" Width="60px" />
            </td>
        </tr>
        <tr>
            <td colspan="5" style="height: 20px">
                <uc2:DbPageFlip ID="DbPageFlip1" runat="server" />
                &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
                <input id="Submit1" name="subPrint" type="submit" value="投标报价一览表" style="width: 90px"
                    class="button_bg6"  /><%--<input id="Submit2" name="subPrint" type="submit"  onclick="doPrint()" value="预览并打印" style="width: 90px" class="button_bg6"   disabled="disabled" />--%>
            </td>
        </tr>
        <tr>
            <td colspan="5" style="height: 20px">
                <!--startprint-->
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowDataBound="GridView1_RowDataBound"
                    Width="100%" CssClass='table_table' HeaderStyle-CssClass='table_title' 
                    ToolTip="报价数据已分页，每一页报完价请保存">
                    <Columns>
                        <asp:BoundField DataField="bidid" HeaderText="投标编号" />
                        <%--0--%>
                        <asp:BoundField DataField="Goodsid" HeaderText="商品流水号" />
                        <%--1--%>
                        <asp:BoundField DataField="productname" HeaderText="通用名" />
                        <%--2--%>
                        <asp:BoundField DataField="outlookc" HeaderText="规格" />
                        <%--3--%>
                        <asp:BoundField DataField="Medicinemodel" HeaderText="剂型" />
                        <%--4--%>
                        <asp:BoundField DataField="ScName" HeaderText="生产企业" />
                        <%--5--%>
                        <asp:BoundField DataField="factor" HeaderText="转换系数" />
                         <asp:BoundField DataField="limitprice" HeaderText="限价" DataFormatString="{0:N2}"/>
                        <%--6--%>
                        <asp:TemplateField HeaderText="报价"></asp:TemplateField>
                        <%--7--%>
                        <asp:BoundField DataField="unit" HeaderText="单位" />
                        <%--8--%>
                        <asp:BoundField DataField="smprice" HeaderText="制剂报价" DataFormatString="{0:N4}" HtmlEncode="False" />
                        <%--9--%>
                        <asp:BoundField DataField="SPPrice" HeaderText="SPPrice" DataFormatString="{0:N2}"
                            HtmlEncode="False" />
                        <%--10--%>
                        <asp:BoundField DataField="PriceSwitching" HeaderText="PriceSwitching" />
                        <%--11--%>
                        <asp:BoundField DataField="FactoryUserCode" HeaderText="生产企业注册号" />
                        <%--12--%>
                        <asp:BoundField DataField="EncryptedPrice" HeaderText="EncryptedPrice" />
                        <%--13--%>
                        <asp:TemplateField ItemStyle-Width="0px">
                        <ItemTemplate >
                             <asp:HiddenField ID="H1" runat="server" /> <asp:HiddenField ID="HP1" runat="server" />
                        </ItemTemplate>

                        <ItemStyle Width="0px">
                        </ItemStyle>
                        </asp:TemplateField>
                        
                    </Columns>
                    <RowStyle CssClass="table_td" />
                    <AlternatingRowStyle CssClass="table_td2" />
                    <HeaderStyle CssClass="table_title" />
                </asp:GridView>
                <!--endprint-->
            </td>
        </tr>
    </table>
    <div align="left">
         
        <asp:Button ID="Button1" runat="server"  Text="Button"  CssClass="button_bg6"  
            OnClientClick="javascript:return CheckUPrice()" onclick="Button1_Click"   />
        <br />
        <font color="red">注意:请在翻页前点击[提交本页报价]按钮来提交您本页的报价,否则您的报价数据讲丢失!<br />
        </font>
    </div>
</asp:Content>
